package com.globefrog.framework.log.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * 异常工具类.
 *
 * @author caijinbang
 * @date 2020-11-08 00:03
 */
public class ExceptionUtils {

  /**
   * 堆栈追踪.
   *
   * @param e 异常
   * @return 堆栈信息
   */
  public static String stackTrace(Throwable e) {
    StringWriter writer = new StringWriter();
    e.printStackTrace(new PrintWriter(writer));
    return writer.toString();
  }

  private ExceptionUtils() {
  }
}
